package Ventas;

import java.io.IOException;
import javax.jdo.PersistenceManager;
import javax.servlet.http.*;
import Libros.PMF;
import java.util.Date;

public class VentaServlet extends HttpServlet {
    
    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
                throws IOException {
        String correo = req.getParameter("email");
        Date date = new Date();
        String total = req.getParameter("total");      
        Venta v = new Venta(correo,date,total);
        PersistenceManager pm = PMF.get().getPersistenceManager();
        try {
            pm.makePersistent(v);
        }catch(Exception e){}       
        finally {
            pm.close();
        }
        resp.sendRedirect("/realizarcompra.jsp");
    }
}
